﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using OgilvyOne.UKNow.BLL;
using OgilvyOne.UKNow.Mobile.Utilities;

namespace OgilvyOne.UKNow.Mobile.APIs.Events
{
    public class CheckEventBegin : IHttpHandler
    {
        public bool IsReusable { get { return false; } }
        public void ProcessRequest(HttpContext context)
        {
            var eventid = context.Request.QueryString["eventid"];
            int eid = 0;
            int.TryParse(eventid, out eid);
            if(eid>0)
            {
                var result = new EventsBLL(2052).CheckEventBegin(eid);
                context.Response.Write(ResultUtility.ReturnResultJson("0", "{" + String.Format("\"flag\":\"{0}\"", result) + "}", result ? "正在举行" : "未举行"));

            }
            else
            {
                context.Response.Write(ResultUtility.ReturnResultJson("-999", "{"+string.Empty+"}", "参数无效"));
                
            }
        }
    }
}
